<?php

namespace catchAdmin\customs\model;


use catcher\base\CatchModel;
use catcher\CatchAuth;


class HnOrderDetail extends CatchModel
{

    protected $name = 'db_customs_hn_order_detail';
    protected $field = [
        'id',
        'order_id',
        'order_no',
        'goods_spu',
        'sku_id',
        'goods_name',
        'goods_sku',
        'mall_order_status',
        'order_status',
        'is_pay',
        'goods_money',
        'tax_difference_money',//税差金额
        'tenant_goods_money',//渠道商商品总额
        'discount_money',//优惠金额
        'total_money',
        'tenant_total_money',//渠道商最终结算价格
        'real_total_money',//api实际支付金额
        'goods_price',//商品单价
        'tenant_goods_price',//渠道商商品SKU价格
        'goods_num',//商品数量
        'deliver_money',//运费金额
        'sku_tax_rate',
        'sku_tax_amount',
        'source_order_no',
        'main_order_id',
        'created_at',
        'updated_at',
        'deleted_at',
        'tenant_id',
        'creator_id',
        'api_return',
        'api_error',
        'sync_api_data_time'
    ];

    // 设置JSON数据返回数组
    protected $jsonAssoc = true;

    protected $json = [
        'api_return',
        'api_error'
    ];

    public function getList()
    {
        $where = [];
//        if($tenant_id !== 0){
//            $where[]=['tenant_id','=',$tenant_id];
//        }

        return $this
            ->withoutField('updated_at,deleted_at,tenant_id,creator_id')
            ->catchSearch()
            ->where($where)
            ->order($this->aliasField('id'), 'desc')
            ->paginate()
            ;
    }

}